home *** CD-ROM | disk | FTP | other *** search
- /*
-
- MEMACS-ShowError
-
- This Arexx program displays the errors generated by the PCQ Pascal
- compiler using the MEMACS text editor from Commodore. It should
- be called as follows:
-
- MEMACS-ShowError SourceFile OutputFile ErrorFile
-
- MEMACS-ShowError reads the errorfile, which must have been
- generated by PCQ Pascal in "quiet" mode. It displays the first
- error in the appropriate source file (not necessarily the
- SourceFile), then erases the OutputFile and ErrorFile.
-
- This file was designed to be an error handler for the PCQ make
- utility. It might work for other purposes, but I'd be careful if
- I were you.
-
- To use this program, you'll need to include the following line in
- your configuration file:
-
- CompilerError rx MEMACS-ShowError \s \d \e
-
- Then you need to add the following line to your S:Emacs_pro file
- (the configuration file for MEMACS):
-
- execute-file S:PCQ-Error
-
- Finally, you'll need to create the S:PCQ-Error file. Normally this
- will just be a dummy statement, but it will be replaced by a more
- complete series of commands by this file. I would suggest creating
- a S:PCQ-Error file with the following contents:
-
- show-line#
-
-
- You'll also need MEMACS and Arexx. Arexx is, of course, a
- commercial program, and MEMACS is one of the text editors supplied
- by Commodore with AmigaDOS. It's in the Tools directory. If you
- have AmigaDOS 2.0, both of these programs are supplied.
-
- */
-
- /* Read the command line parameters */
-
- parse arg SourceFileName OutputFileName ErrorFileName .
-
- options results
-
-
- /* Get the first error */
-
- if open(logfile, ErrorFileName, 'R') then do
-
- if eof(logfile) then do /* There were no errors */
- FileName = SourceFileName
- LineNo = 1
- ColumnNo = 1
- end; else do
- ErrorString = readln(logfile)
-
- /* This first test is just a reminder, in case you want to */
- /* process all errors. "Abort" would never come first. */
-
- if ErrorString = "Compilation Aborted" then do
- address command 'delete >nil:' outputfile
- 'okay1 Compilation Aborted'
- exit
- end
-
- if ErrorString ~= "" then do
- parse var ErrorString '"' FileName '" At ' LineNo,
- ',' ColumnNo .
- end; else do
- FileName = SourceFileName
- LineNo = 1
- ColumnNo = 1
- end
- end
- close(logfile)
- end; else do
- say 'Could not open error file'
- exit
- end
-
- RightMost = max(pos('/',ErrorFileName),pos(':',ErrorFileName))
- JustErrorName = substr(ErrorFileName,RightMost+1)
-
- RightMost = max(pos('/',FileName),pos(':',FileName))
- JustFileName = substr(FileName,RightMost+1)
-
- if open(logfile, 'S:PCQ-Error', 'W') then do
-
- writeln(logfile, 'visit-file' ErrorFileName);
-
- writeln(logfile, 'split-window');
- writeln(logfile, 'select-buffer' strip(left(JustFileName,15)));
-
- writeln(logfile, 'next-window');
-
-
- /* The version of MEMACS I'm currently using can't seem to */
- /* handle the shrink-window command in a file, and it does */
- /* bizarre things with forw-char. Therefore they are both */
- /* commented out. */
-
- /* do for 6
- writeln(logfile, 'shrink-window');
- end; */
-
- writeln(logfile, 'prev-window');
- writeln(logfile, 'goto-line' LineNo);
- writeln(logfile, 'start-of-line');
-
- /* do for ColumnNo
- writeln(logfile, 'forw-char');
- end; */
-
- close(logfile);
- end; else do
- say 'Could not open command file'
- end;
-
-
- /* Load MEMACS */
-
- address command memacs FileName
-
- /* After it quits, reset the command file and delete the */
- /* temporary files. */
-
- if open(logfile, 'S:PCQ-Error', 'W') then do
- Writeln(logfile, 'show-line#');
- close(logfile);
- end; else do
- say 'Error writing to command file';
- end;
-
- /* Delete the temporary files */
-
- address command 'delete >Nil:' ErrorFileName
- address command 'delete >Nil:' OutputFileName
-
-